package com.jiazhong.封装;

public class Encapsulation01 {
    public static void main(String[] args) {

    }
}
//年龄，工资为隐私，不可查阅，为私有化
class Person{
    String name;
    private int age;
    private int Salary;//工资

    public Person() {
    }

    public Person(String name, int age, int salary) {
        setName(name);
        setAge(age);
        setSalary(salary);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public int getSalary() {
        return Salary;
    }

    public void setSalary(int salary) {
        Salary = salary;
    }
    //返回属性信息
    public String info(){
        return "信息为name="+name+"age"+age+"薪水"+Salary;
    }
}
